package com.wgchao.amc.autho;

import javax.servlet.http.HttpSession;

/**
 * @ClassName: InfoCenter
 * @author: wgchao
 * @createTime: 2019/10/21 2:27 PM
 * @Description: 认证信息中心
 */
public class AuthoInfoCenter {

    private HttpSession session;

    public static AuthoInfoCenter getInstance(HttpSession session) {
        AuthoInfoCenter authoInfoCenter = new AuthoInfoCenter();
        authoInfoCenter.session = session;
        return authoInfoCenter;
    }

    public void saveUserInfo(UserInfo userInfo){
        session.setAttribute("user", userInfo);
    }

    public UserInfo getUserInfo(){
        return (UserInfo) session.getAttribute("user");
    }

    public Long getUserId(){
        UserInfo userInfo = (UserInfo) session.getAttribute("user");
     //   return 1L;
        return userInfo.getUserId();
    }

    public String getAgencyCode(){
        UserInfo userInfo = (UserInfo) session.getAttribute("user");
     //   return "3702";
        return userInfo.getAgencyCode();
    }
}
